package com.codebuffer.nowcoder;

public class CutRope {
    public static void main(String[] args) {

        System.out.println(cutRope(2));
    }

    public static int cutRope(int target) {
        if(target==2){
            return 1;
        }
        if(target==3){
            return 2;
        }
        int []cut = new int[target+1];
        cut[1] = 1;
        cut[2] = 2;
        cut[3] = 3;
        for (int i = 4; i <= target; i++) {
            for (int j = 1; j <= i/2; j++) {
                cut[i] = Math.max(cut[j]*cut[i-j],cut[i]);
            }
        }
        return cut[target];
    }
}
